<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div style="text-align: center;font-size: 30px;" id="time">5</div>
    <script>
        setInterval(function(){
            //获得div中的数字怕【5】
            let num = document.querySelector("#time").innerHTML;
            //对数
            num--;
            //把--之后的数字放回div中
            document.querySelector("#time").innerHTML=num;
            //判断数字等于0就跳转
            if(num==0){
                location.href="http://www.baidu.com";
            }
        },1000);
    </script>
</body>
</html>